1 /*-------------------------------------------------------------------------------------------------------*\
2 | Adium, Copyright (C) 2001-2005, Adam Iser (adamiser@mac.com | http://www.adiumx.com) |
3 \---------------------------------------------------------------------------------------------------------/
4 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU
5 | General Public License as published by the Free Software Foundation; either version 2 of the License,
6 | or (at your option) any later version.
8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9 | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
10 | Public License for more details.
12 | You should have received a copy of the GNU General Public License along with this program; if not,
13 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14 \------------------------------------------------------------------------------------------------------ */
16 //This documentation comment doesn't show up. I don't know why. --boredzo
18 * @brief A gradient direction.
19 * Can be left-to-right or bottom-to-top.
22 /*! @brief Left-to-right.
23 * The far left point in the gradient will be the first color; the far right point will be the second color.
26 /*! @brief Bottom-to-top.
27 * The bottom point in the gradient will be the first color; the top point will be the second color.
33 * @brief Cocoa wrapper around lower level (CoreGraphics) gradient drawing functions, implementing two-color linear gradients.
35 @interface AIGradient
: NSObject
{
36 enum AIDirection direction
;
42 * @brief Create a horiztonal or vertical gradient between two colors
44 * @param inColor1 The starting NSColor
45 * @param inColor2 The ending NSColor
46 * @param inDirection The \c AIDirection for the gradient
47 * @return An autoreleased \c AIGradient
49 + (AIGradient
*)gradientWithFirstColor
:(NSColor
*)inColor1
50 secondColor
:(NSColor
*)inColor2
51 direction
:(enum AIDirection
)inDirection
;
54 * @brief Create a gradient for a selected control
56 * Use the system selectedControl color to create a gradient in the specified direction. This gradient is appropriate
57 * for a Tiger-style selected highlight.
59 * @param inDirection The \c AIDirection for the gradient
60 * @return An autoreleased \c AIGradient for a selected control
62 + (AIGradient
*)selectedControlGradientWithDirection
:(enum AIDirection
)inDirection
;
65 * @brief Set the first (left or bottom) color.
67 * @param inColor The first \c NSColor.
69 - (void)setFirstColor
:(NSColor
*)inColor
;
72 * @brief Return the first (left or bottom) color.
74 * @result The first color.
76 - (NSColor
*)firstColor
;
79 * @brief Set the second (right or top) color.
81 * @param inColor The second \c NSColor.
83 - (void)setSecondColor
:(NSColor
*)inColor
;
86 * @brief Return the second (right or top) color.
88 * @result The second color.
90 - (NSColor
*)secondColor
;
93 * @brief Set the direction for the gradient.
95 * @param inDirection The \c AIDirection for the gradient.
97 - (void)setDirection
:(enum AIDirection
)inDirection
;
100 * @brief Return the direction for the gradient.
102 * @result The \c AIDirection for the gradient.
104 - (enum AIDirection
)direction
;
107 * @brief Draw the gradient in an \c NSRect.
109 * @param rect The \c NSRect in which to render the gradient.
111 - (void)drawInRect
:(NSRect
)rect
;
113 /*! @brief Draw the gradient in an \c NSBezierPath.
115 * The gradient will fill the specified path according to the path's winding rule, transformation matrix, and so on.
117 * @param inPath The \c NSBezierPath in which to render to gradient.
119 - (void)drawInBezierPath
:(NSBezierPath
*)inPath
;